package com.heima.controller.user;

import com.heima.pojo.dto.LoginDto;
import com.heima.pojo.vo.LoginUserVo;
import com.heima.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

@RestController
@RequestMapping("/api/user-service/user")
@Slf4j
public class LoginController {

    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public LoginUserVo login(@RequestBody LoginDto dto){
        log.info("登录验证");
        return userService.login(dto);
    }

    /**
     * 生成验证码
     */
    @GetMapping("/imageCode/{clientToken}")
    public String imageCode(@PathVariable String clientToken) throws IOException {
        log.info("生成随机验证码"+clientToken);
        // 生成随机验证码
        // TODO
        //
        return null;
    }



}
